<template>
  <div>
    <MyHeader title="购物车案例" backgroundColor="skyblue" color="white" />

    <div class="main">
      <MyGoods v-for="obj in list" :key="obj.id" :goodsObj="obj" />
    </div>
    <MyFooter :arr="list" />
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyGoods from "./components/MyGoods";
import MyFooter from "./components/MyFooter";

export default {
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.$axios({
      url: "https://www.escook.cn/api/cart",
    }).then((res) => {
      this.list = res.data.list;
    });
  },
};
</script>

<style scoped>
.main {
  padding: 45px 0 50px 0;
}
</style>